package cn.tedu.management.resident.controller;


import cn.tedu.management.resident.pojo.dto.ResidentInsert;
import cn.tedu.management.resident.pojo.dto.ResidentQuery;
import cn.tedu.management.resident.service.ResidentService;
import cn.tedu.manamgement.common.response.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "住户模块")
@RequestMapping("/v1/resident/")
@RestController
public class ResidentController {

    @Autowired
    ResidentService residentService;

    @ApiOperation(value = "住户查询功能")
    @GetMapping("select")
    public JsonResult selectResident(@RequestBody ResidentQuery residentQuery){
        log.debug("查询业务:residentQuery={}",residentQuery);
        residentService.selectResi(residentQuery);
        return JsonResult.ok(residentQuery);
    }



    @ApiOperation(value = "住户新增功能")
    @PostMapping("insert")
    /*RequestBody注解是看前端发过来的请求是否经过处理*/
    public JsonResult insertResident(@RequestBody ResidentInsert residentInsert){
        log.debug("新增住户功能:参数={}",residentInsert);
        return JsonResult.ok(null);
    }


    @ApiOperation(value = "住户更新功能")
    @PostMapping("update")
    public JsonResult updateResident(@RequestBody ResidentInsert residentInsert){
        log.debug("更新住户信息:参数={}",residentInsert);
        return JsonResult.ok(null);
    }


    @ApiOperation(value = "住户删除功能")
    @PostMapping("delete")
    public JsonResult deleteResident(@RequestBody ResidentQuery residentQuery){
        log.debug("删除住户信息:参数={}",residentQuery);
        return JsonResult.ok(null);
    }

}
